package com.zhentao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhentao.model.banner.pojo.AdBanner;
import com.zhentao.model.common.dtos.PageResponseResult;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.pay.dto.PayDto;
import com.zhentao.model.pay.pojo.WithdrawRule;
import com.zhentao.model.pay.vo.FinancialVo;
import com.zhentao.service.WithdrawRuleService;
import com.zhentao.mapper.WithdrawRuleMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author 许文倩
* @description 针对表【withdraw_rule】的数据库操作Service实现
* @createDate 2024-07-12 09:03:16
*/
@Service
public class WithdrawRuleServiceImpl extends ServiceImpl<WithdrawRuleMapper, WithdrawRule>
    implements WithdrawRuleService{
    @Resource
    WithdrawRuleMapper withdrawRuleMapper;

    @Override
    public PageInfo<WithdrawRule> getList(PayDto dto) {
        PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
        List<WithdrawRule> payVos=withdrawRuleMapper.selectList(null);
        PageInfo<WithdrawRule> financialVoPageInfo=new PageInfo<>(payVos);
        return financialVoPageInfo;
    }

    @Override
    public ResponseResult add(WithdrawRule withdrawRule) {
        withdrawRuleMapper.insert(withdrawRule);
        return ResponseResult.okResult("添加成功！");
    }

    @Override
    public ResponseResult updateRule(WithdrawRule withdrawRule) {
        withdrawRuleMapper.updateById(withdrawRule);
        return ResponseResult.okResult("修改成功！");
    }
}




